//
//  FZButton.m
//  自定义buttonDemo
//
//  Created by 李忠 on 7/8/16.
//  Copyright © 2016 SD. All rights reserved.
//

#import "SDverticalButton.h"
#import "UIView+SDExtension.h"

@implementation SDverticalButton

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.font = [UIFont boldSystemFontOfSize:18];
    }
    return self;
}

- (void)setHighlighted:(BOOL)highlighted{
    
}
- (void)layoutSubviews{
    [super layoutSubviews];
    
    // 调整图片
    CGFloat width = self.imageView.image.size.width;
    CGFloat height = self.imageView.image.size.height;
    
    CGPoint center = CGPointMake(self.sdWidth * 0.5, self.sdHeight * 0.5);
    self.imageView.center = center;
    self.imageView.sdWidth = width;
    self.imageView.sdHeight =  height;

    // 调整文字
    self.titleLabel.sdX = 0;
    self.titleLabel.sdY = CGRectGetMaxY(self.imageView.frame);
    self.titleLabel.sdWidth = self.sdWidth;
    self.titleLabel.sdHeight = self.sdHeight - self.titleLabel.sdY;
}

//- ()

@end
